package com.vo;

import java.text.SimpleDateFormat;
import java.util.Date;

public class UnsynchronizedBank {

    private int count =0;//账户余额
    private SimpleDateFormat SimpleDateFormatdateFormater=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");

    //存钱
    public  void addMoney(int money){
        count +=money;
        System.out.println(SimpleDateFormatdateFormater.format(System.currentTimeMillis())+"存进："+money);
    }

    //取钱
    public  void subMoney(int money){
        if(count-money < 0){
            System.out.println("余额不足");
            return;
        }
        count -=money;
        System.out.println(SimpleDateFormatdateFormater.format(new Date())+"取出："+money);
    }

    //查询
    public void lookMoney(){
        System.out.println("账户余额："+count);
    }
}